package com.yhao.simpledemo.service;

import java.time.LocalDateTime;
import java.util.HashMap;
import java.util.Map;

/**
 * @author : yhao
 * @Date : 2023/3/29 - 9:18
 * @Desc : TODO
 */
public class SendMessage {

    public static void main(String[] args) {
        // 钉钉的webhook
        String dingDingToken = "https://oapi.dingtalk.com/robot/send?access_token=fc69e259abd98061ab9f071db1e3f63d197884460c76bf5b18a91c6e6b7a75c8";
        // 请求的JSON数据，这里我用map在工具类里转成json格式
        Map<String, Object> json = new HashMap();
        Map<String, Object> text = new HashMap();
        json.put("msgtype", "text");
        text.put("content", "这是一条测试信息哦，请忽略" + LocalDateTime.now());
        json.put("text", text);
        // 发送post请求
        String response = DingTalkHttpsUtil.sendPostByMap(dingDingToken, json);
        System.out.println("相应结果：" + response);

    }
}
